import worker from '@ohos.worker'
const workPort = worker.workerPort
workPort.onmessage = function (e){
  let data= e.data
  workPort.postMessage(add(1,2))
}
workPort.onerror = function (e){
  console.log("worker")
}
function add(num1,num2){
  return num1+num2
}